import React from "react";
// 设置一级路由
import { Routes, Route, Navigate } from 'react-router-dom'
// 路由懒加载
import { lazy, Suspense } from 'react'
// 引入组件
// import Index from './pages/index'
// import GoodsList from './pages/goodsList'
// import GoodsDetail from './pages/goodsDetail'
// import Coupon from './pages/coupon'
// 懒加载
const Index = lazy(() => import('./pages/index'))
const GoodsList = lazy(() => import('./pages/goodsList'))
const GoodsDetail = lazy(() => import('./pages/goodsDetail'))
const Coupon = lazy(() => import('./pages/coupon'))
const Indent = lazy(() => import('./pages/indent'))
const Login = lazy(() => import('./pages/login'))
const Register = lazy(() => import('./pages/register'))
const MapLogin =lazy(()=>import('./pages/mapLogin'))
function App() {
  return (
    <div>
      <Suspense>
        {/* 路由出口 */}
        <Routes>
          {/* path内容是自定义  element 要渲染的组件*/}
          <Route path="/index/*" element={<Index />}></Route>
          <Route path="/list" element={<GoodsList />}></Route>
          <Route path="/detail" element={<GoodsDetail />}></Route>
          <Route path="/pon" element={<Coupon />}></Route>
          <Route path="/indent" element={<Indent />}></Route>
          <Route path="/login" element={<Login />}></Route>
          <Route path="/register" element={<Register />}></Route>
          <Route path="/mapLogin" element={<MapLogin/>}></Route>
          <Route path='*' element={<Navigate to={'/index'}></Navigate>}></Route>
        </Routes>
      </Suspense>
    </div>
  )
}

export default App;
